﻿using System;
using System.Diagnostics.Contracts;
using System.IO;

namespace OpenLS.Spreadsheet.Formats.Biff.OfficeArt
{
    internal class OfficeArtBlipTIFF : OfficeArtStandardBlip
    {
        private TiffFormat _nativeFormat;

        public OfficeArtBlipTIFF(byte[] data)
        {
        }

        public OfficeArtBlipTIFF()
        {
        }

        public override RecType RecordType
        {
            get { return RecType.OfficeArtBlipTIFF; }
        }

        protected override string Extension
        {
            get { return "tiff"; }
        }

        protected override ushort Format
        {
            get { return (ushort) NativeFormat; }
            set { NativeFormat = (TiffFormat) value; }
        }

        protected TiffFormat NativeFormat
        {
            get {
                Contract.Ensures(Enum.IsDefined(typeof(TiffFormat), Contract.Result<TiffFormat>()));
                return _nativeFormat;
            }
            set {
                Contract.Requires(Enum.IsDefined(typeof(TiffFormat), value));
                _nativeFormat = value;
            }
        }

        protected override UidCount HasTwoIds()
        {
            switch (NativeFormat)
            {
                case TiffFormat.One:return UidCount.One;
                case TiffFormat.Two: return UidCount.Two;
                default: throw new NotSupportedException();
            }
        }

        internal override MSOBLIPTYPE Type
        {
            get { return MSOBLIPTYPE.msoblipTIFF; }
        }
        internal enum TiffFormat : ushort
        {
            One = 0x6E4,
            Two = 0x6E5,
        }
    }

    
}